#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
MODULE_PATH=/usr/lib/nodejs/fibers/build/Release/obj.target/fibers.node
BIN_PATH=/usr/lib/nodejs/fibers/bin

%:
	dh $@ --with nodejs

override_dh_install:
	dh_install
	dh_buildinfo
	chmod 644 $(CURDIR)/debian/node-fibers$(MODULE_PATH)
	chmod -R 644 $(CURDIR)/debian/node-fibers$(BIN_PATH)/linux*/*

#override_dh_link:
#	dh_link `gdal-config --datadir` usr/lib/nodejs/fibers/fibers_data

#override_dh_auto_configure:
#	node-gyp configure -module_name=fibers 
# -module_path=src/binding/ 
# -shared_gdal=1

override_dh_auto_build:
#	node-gyp build
#	node build.js
	make all

#override_dh_auto_test:
#	ln -s $(CURDIR)/build/lib/binding $(CURDIR)/lib/
# disable a test that needs gdal 1.11 to succeed
#	rm $(CURDIR)/lib/binding
#	exit ${testOk}

override_dh_shlibdeps:
	dpkg-shlibdeps \
		-T$(CURDIR)/debian/node-fibers.substvars \
		$(CURDIR)/debian/node-fibers$(MODULE_PATH)

override_dh_strip:
	strip \
		--remove-section=.comment \
		--remove-section=.note \
		--strip-unneeded \
		$(CURDIR)/debian/node-fibers$(MODULE_PATH)
